﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.Data;
using Microsoft.SqlServer.Server;
using System.Data.SqlTypes;

/*
public class Crypt
{
    [Microsoft.SqlServer.Server.SqlFunction]
    public static SqlBytes Sha256(SqlString text)
    {
        HashAlgorithm hash = new SHA256Managed();
        return new SqlBytes(hash.ComputeHash(text.GetUnicodeBytes()));
    }
}
*/

 public class Hash
    {

    public string getHashSha256(string text)
    {
        byte[] bytes = Encoding.Unicode.GetBytes(text);
        SHA256Managed hashstring = new SHA256Managed();
        byte[] hash = hashstring.ComputeHash(bytes);
        string hashString = string.Empty;
        foreach (byte x in hash)
        {
            hashString += String.Format("{0:x2}", x);
        }
        return hashString;
    }

    public string getter(string a)
    {
        return a;
    }

}
